//
// Created by nilyang on 2021/11/13.
//
#include "include.h"
#include "grammars.h"

void test_ambiguous() {
    func_ambiguous(1, 2.1);
}

void func_ambiguous(int n, float f) {
    printf("int=%d,float=%f", n, f);
}


void func_gramma() {
    test_ambiguous();
}


void func_enum_class() {
    Color color = Color::red;
    Traffic_light light = Traffic_light::red;
}

void func_union(Entry *p) {
    if (p->t == str) {
        std::cout << p->v.s;
    } else if (p->t == num) {
        std::cout << p->v.i;
    }
}


#if CPP_STANDARD >= 202002L
#include <functional>
void func_grammars() {
    std::cout << "Hello polymorphic_transform:Yes\n";
}

void func_cpp20_closure() {
    [out = std::ref(std::cout<< "Result from C code: \n")] (){
        out.get() << ".\n";
    }();
};

#else
void func_grammars() {
    std::cout << "Hello polymorphic_transform:No\n";
}
#endif





